From 6de0b580adb18d3eec3967df85a6333abbbe0c4a Mon Sep 17 00:00:00 2001 From: Hilko Bengen Date: Tue, 23 Jul 2019 14:43:21 +0200 Subject: [PATCH] Add --with-ebpf-includes parameter Last-Update: 2025-07-11 Bug: https://redmine.openinfosecfoundation.org/issues/3097 This patch fixes a FTBFS error on the i386 architecture by setting proper include directories. The error is caused by improper directory names e.g. '-I/usr/include/i386-linux-gnu' vs. '-I/usr/include/i686-linux-gnu/'. Gbp-Pq: Name with-ebpf-includes.patch --- configure.ac | 6 +++++- ebpf/Makefile.am | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index f0f5aca7..eed8f63f 100644 --- a/configure.ac +++ b/configure.ac @@ -499,7 +499,11 @@ AC_SUBST(LLC) ], [AC_MSG_ERROR([clang needed to build ebpf files])]) - AC_MSG_CHECKING([libbpf has bpf/bpf_helpers.h]) + AC_ARG_WITH(ebpf_includes, + [ --with-ebpf-includes=DIR include directory for building eBPF programs], + [AC_SUBST([ebpf_includes],["$withval"])], + [AC_SUBST([ebpf_includes],["/usr/include/${build_alias}"])]) + AC_MSG_CHECKING([libbpf has bpf/bpf_helpers.h]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [ diff --git a/ebpf/Makefile.am b/ebpf/Makefile.am index d43c2c97..898c5bd7 100644 --- a/ebpf/Makefile.am +++ b/ebpf/Makefile.am @@ -4,7 +4,7 @@ EXTRA_DIST= include bypass_filter.c filter.c lb.c vlan_filter.c xdp_filter.c \ if BUILD_EBPF # Maintaining a local copy of UAPI linux/bpf.h -BPF_CFLAGS = -Iinclude +BPF_CFLAGS = -Iinclude -I$(ebpf_includes) BPF_TARGETS = lb.bpf BPF_TARGETS += filter.bpf @@ -19,7 +19,6 @@ all: $(BPF_TARGETS) $(BPF_TARGETS): %.bpf: %.c # From C-code to LLVM-IR format suffix .ll (clang -S -emit-llvm) ${CLANG} -Wall $(BPF_CFLAGS) -O2 -g \ - -I/usr/include/$(build_cpu)-$(build_os)/ \ -D__KERNEL__ -D__ASM_SYSREG_H \ -target bpf -S -emit-llvm $< -o ${@:.bpf=.ll} # From LLVM-IR to BPF-bytecode in ELF-obj file -- 2.30.2